import 'package:flutter/material.dart';
import 'package:lianwenke20220712/home_page.dart';
import 'package:umeng_common_sdk/umeng_common_sdk.dart';

/// FileName 连文科
///
/// @Author/// @Date 2022/7/12 14:11
///
/// @Description 开屏页
/// 参考图1完成欢迎页，App启动展示欢迎页，2秒后自动进入图2
class HomeOneWidget extends StatefulWidget {
  const HomeOneWidget({Key key}) : super(key: key);

  @override
  _HomeOneWidgetState createState() => _HomeOneWidgetState();
}

class _HomeOneWidgetState extends State<HomeOneWidget> with SingleTickerProviderStateMixin{
  AnimationController _animationController;
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    //参考图1完成欢迎页，App启动展示欢迎页，2秒后自动进入图2
    _animationController = AnimationController(vsync: this,duration: Duration(milliseconds: 2000),lowerBound: 0,upperBound: 1);
    //启动动画
    _animationController.forward();
    //动画监听
    _animationController.addStatusListener((status) {
      if(status == AnimationStatus.completed){
        Navigator.of(context).push(MaterialPageRoute(builder: (context){
          return HomePageWidget();
        }));
      }
    });
    
    UmengCommonSdk.initCommon('62cd3e2605844627b5e60ff4', '62cd3e2605844627b5e60ff4', 'Umeng');
  }
  //防止内存泄漏
  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    _animationController.dispose();
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ScaleTransition(
        scale: _animationController,
        child: Image.asset('assets/images/huanying.jpg',fit: BoxFit.fill,height: MediaQuery.of(context).size.height,),
      ),
    );
  }
}
